#include "a_small_play.h"
#include "ui_a_small_play.h"
#include <QPushButton>
#include <QDebug>


a_small_play::a_small_play(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::a_small_play)
{
    ui->setupUi(this);
    this->setGeometry(QRect(350,180,850,550));//在构造函数里设置了窗口的大小和位置
    setFixedSize(850,550);//固定窗口大小

    cho=new chooselevel();//初始化选择界面
    //创建开始界面的两个按钮
    //开始按钮
    QPushButton *btn1=new QPushButton("Begin",this);
    btn1->setParent(this);
    btn1->resize(200,50);
    btn1->move(130,400);

    connect(btn1,&QPushButton::clicked,this,&QWidget::close);//设置退出的效果
    connect(btn1,&QPushButton::clicked,cho,&chooselevel::show);//设置新打开选择界面的效果

    //退出按钮
    QPushButton *btn2=new QPushButton("off",this);
    btn2->setParent(this);
    btn2->resize(200,50);
    btn2->move(523,400);

    connect(btn2,&QPushButton::clicked,this,&QWidget::close);//设置退出的效果

    connect(cho,&chooselevel::backp,this,[=]{
        this->show();
    });//设置在选择界面点击返回后可以跳转回主界面的效果


}


void a_small_play::paintEvent(QPaintEvent *)
{
    QPainter painter(this);
    painter.drawPixmap(0,0,850,550,QPixmap(":/images/images/13.jpg"));
}

a_small_play::~a_small_play()
{
    delete ui;
}
